local ma__guoyi = fk.CreateSkill {
  name = "ma__guoyi"
}

Fk:loadTranslationTable{
  ["ma__guoyi"] = "果毅",
  [":ma__guoyi"] = "当你成为牌的目标后，你可以弃置所有手牌，然后弃置至多等量名其他角色区域内的各一张牌，若弃置的牌颜色均相同，你可以获得其中一张。",

  ["ma__guoyi_max"] = "%dest本回合手牌上限+2",
  ["#ma__guoyi-invoke"] = "虚宠：选择执行一项并获得一张【影】",
}

ma__guoyi:addEffect(fk.TargetConfirmed, {
  anim_type = "control",
  can_trigger = function(self, event, target, player, data)
    return player:hasSkill(ma__guoyi.name) and not player:isKongcheng()
      and table.every(player.player_cards[Player.Hand], function(id) return not player:prohibitDiscard(Fk:getCardById(id)) end)
  end,
  on_cost = function(self, event, target, player, data)
    local room = player.room
    local cards = table.every(player.player_cards[Player.Hand], function(id)
     return not player:prohibitDiscard(Fk:getCardById(id)) end)
    local targets = table.filter(room.alive_players, function(p)
      return not (p == player or p:isAllNude()) end)
    local n = #cards
    if #targets == 0 then return end
    local tos = room:askToChoosePlayers(player, {
      min_num = 1,
      max_num = n,
      targets = targets,
      skill_name = ma__guoyi.name,
      prompt = "#ma__yingtai-dead",
      cancelable = true,
    })
    event:setCostData(self, {tos = tos})
      return true
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    local targets = event:getCostData(self).tos
    local cards = table.every(player.player_cards[Player.Hand], function(id)
     return not player:prohibitDiscard(Fk:getCardById(id)) end)
    local colors = {}
    local recard = {}
    for _, id in ipairs(cards[player]) do
      table.insert(recard, Fk:getCardById(id))
      table.insert(colors, Fk:getCardById(id).color)
    end
    player:throwAllCards("h", ma__guoyi.name)
    for _, to in ipairs(targets) do
      if not to:isAllNude() then
      local card = room:askToChooseCard(player, {
        target = to,
        flag = "hej",
        skill_name = ma__guoyi.name,
      })
      room:throwCard(card, ma__guoyi.name, to, player)
      table.insert(recard, Fk:getCardById(card))
      table.insert(colors, Fk:getCardById(card).color)
      end
    end
    if #colors == 1 then
      if recard == 1 then
        
      end 
    end
  end,
})

return ma__guoyi